# 生产者 -- 任务  函数.
# 1. 这个函数必须要让 celery实例中的task装饰器装饰.
# 2. 需要celery 自动检测指定包的任务.

from celery_tasks.main import app
from django.core.mail import send_mail


@app.task
def celery_send_email(subject, message, html_message, from_email, recipient_list):
    """
    异步发送邮件;
    """
    send_mail(subject=subject, message=message, html_message=html_message, from_email=from_email,
              recipient_list=recipient_list)
